package job;

import java.text.SimpleDateFormat;
import java.util.Date;

import play.jobs.Every;
import play.jobs.Job;
import play.jobs.On;
import services.BackCountService;
import vos.ReturnCode;

/**
 * 每月最后一天的23点自动月末统计
 * 
 * @ClassName: MonthCount 
 * @author: wangsm
 * @date: 2016年6月8日 上午9:32:36
 */
@On("0 0 23 L * ? *")
public class MonthCount extends Job {
	private static final SimpleDateFormat monthFormater = new SimpleDateFormat("yyyy-MM");
	@Override
	public void doJob(){
		//查找该月份是否已经统计过
		Date date=new Date();
		String datestr=monthFormater.format(date);
		Long monLong=BackCountService.countByMonth(datestr);
		if(monLong>0){
			System.out.println("本月已经进行统计");
			return;
		}
		BackCountService.countMonth("system");
	}
}
